package org.example.designpatterns.singleton.demo6;

import org.example.designpatterns.singleton.demo6.unbinder.Unbinder;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Gong.Yang
 */
public class UnbinderManager {
    List<Unbinder> list = List.of();        //假如这里存放了所有解绑者的实现

    public void unbindTask(String thirdCode, String mobile, String tag) {
        //遍历解绑者
        for (Unbinder unbinder : list) {

            if (unbinder.match(tag)) {//匹配得上则使用解绑器进行具体的解绑
                unbinder.process(thirdCode, mobile);
            }

        }
    }
}
